package com.example.service.impl;

import com.example.Dao.OrderdetailDao;
import com.example.entity.Orderdetail;
import com.example.entity.Orders;
import com.example.service.OrderdetailService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class OrderdetailServiceImpl implements OrderdetailService {
   @Resource
    OrderdetailDao orderdetailDao;
    @Override
    public PageInfo<Orderdetail> queryAll(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Orderdetail> list=orderdetailDao.queryAll();
        PageInfo<Orderdetail> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int deleteByID(Integer id) {
        return orderdetailDao.deleteByID(id);
    }

    @Override
    public ArrayList<Orderdetail> query(Integer oid) {
        return orderdetailDao.query(oid);
    }

    @Override
    public Orderdetail findById(Integer id) {
        return orderdetailDao.findById(id);
    }

    @Override
    public int update(Orderdetail orderdetail) {
        return orderdetailDao.update(orderdetail);
    }

    @Override
    public int insert(Orderdetail orderdetail) {
        return orderdetailDao.insert(orderdetail);
    }
}
